home *** CD-ROM | disk | FTP | other *** search
- Listing 1
-
- //THE FOLLOWING TEMPLATE WORKS OK AS LONG AS IT'S NOT NESTED:
-
- template <class X >
- struct SimpleVector
- {
- X *data;
- SimpleVector(int len) : data(new X[len]) {}
- ~SimpleVector() { delete [] data;}
-
- };
-
- // NO WAY TO PROVIDE INNER SimpleVector CONSTRUCTOR WITH AN
- // ARGUMENT OF cols:
-
- template <class X >
- struct UnconstructableMatrix :
- public SimpleVector<SimpleVector<X>>
- {
- UnconstructableMatrix(int rows,int cols)
- : SimpleVector<SimpleVector<X>>(rows) {}
- };
-